class CmodelsController < ApplicationController
  layout "backend"
  def index
    @cmodels = Cmodel.find(:all)
  end
  def show
    @cmodel = Cmodel.find(params[:id])
  end
  def new
    @cmodel = Cmodel.new
    @manufacturers = Manufacturer.find(:all)
  end
  def edit
    @cmodel = Cmodel.find(params[:id])
  end
  def create
    @cmodel = Cmodel.new(params[:cmodel])
    if @cmodel.save
      flash[:notice] = 'Cmodel was successfully created.'
      redirect_to :action => "index"
    else
      render :action => "new"
    end
  end
  def update
    @cmodel = Cmodel.find(params[:id])
    if @cmodel.update_attributes(params[:cmodel])
      flash[:notice] = 'Cmodel was successfully updated.'
      redirect_to :action => "index"
    else
      render :action => "edit"
    end
  end
  def destroy
    @cmodel = Cmodel.find(params[:id])
    @cmodel.destroy
    redirect_to :action => "index"
  end
end
